<div ng-controller="modulesGoodsAddCtrl">
    <div class="bg-light lter b-b wrapper-md">
        <h4 class="m-n font-thin">模块商品管理</h4>
        <button class="btn-back btn btn-dark btn-sm btn-rounded" ui-sref="app.modulesGoods({id:id})">
            返回
        </button>
    </div>
    <div class="wrapper-md panel-body">

        <div class="col-sm-5 col-sm-12">
            <div class="panel-body panel">
                <div>
                    <table class="table-responsive table table-bordered table-striped b-t b-light m-n">
                        <thead>
                        <tr>
                            <th>图片</th>
                            <th>名称</th>
                            <th width="70">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="item in modulesGoods">
                            <td>
                                <div>
                                    <img src="{{app.image.goods}}{{item.fileName}}" style="height: 40px;width: 40px;"/>
                                </div>
                            </td>
                            <td>
                                <span>{{item.name}}</span>
                            </td>
                            <td width="70">
                                <button class="btn btn-sm btn-danger" ng-click="delModulesGoods(item)">移除</button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div class=" panel-body h6 text-center padder-v"
                         ng-if="modulesGoods==null || modulesGoods.length<=0">~请从商品栏选择您要添加的新商品~
                    </div>
                    <div>
                        <circle-loading ng-if="app.loading"></circle-loading>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-7 col-sm-12">
            <div class="panel">
                <div class="panel-body">
                    <div class="col-sm-8 text-left">
                        <form class="form-inline">
                            <div class="form-group">
                                <label class="control-label">店铺</label>
                                <select class="form-control" ng-model="goodsListVO.shopId">
                                    <option value="">请选择店铺</option>
                                    <option value="{{item.id}}" ng-repeat="item in shopNames">{{item.name}}</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label class="control-label">名称</label>
                                <input type="text" class="input-sm form-control" placeholder="商品名称"
                                       ng-model="goodsListVO.name">
                            </div>
                            <button class="btn btn-sm btn-info" ng-click="findPageAll()">查询</button>
                        </form>
                    </div>
                </div>
                <div>
                    <div class="table-responsive panel-body">
                        <table class="table table-bordered table-striped b-t b-light b-b">
                            <thead>
                            <tr>
                                <th>商品图片</th>
                                <th>商品名称</th>
                                <th>经营类型</th>
                                <th>是否分销</th>
                                <th>是否返利</th>
                                <th>让利值</th>
                                <th width="70">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr ng-repeat="item in list">
                                <td>
                                    <div>
                                        <img src="{{app.image.goods}}{{item.fileName}}"
                                             style="height: 40px;width: 40px;"/>
                                    </div>
                                </td>
                                <td>
                                    <span>{{item.name}}</span>
                                </td>
                                <td>
                                    <p ng-if="item.type==0" class="label bg-success h6">到店</p>
                                    <p ng-if="item.type==1" class="label bg-warning h6">配送</p>
                                    <p ng-if="item.type==2" class="label bg-info h6">直邮</p>
                                    <p ng-if="item.type==3" class="label bg-primary h6">堂食</p>
                                    <p ng-if="item.type==4" class="label bg-danger h6">预定</p>
                                </td>
                                <td>
                                    <span class="label bg-light"
                                          ng-class="{0:'bg-light',1:'bg-success'}[item.isOpenSell]"
                                          ng-bind="{0:'否',1:'是'}[item.isOpenSell]"></span>
                                </td>
                                <td>
                                    <span class="label bg-light"
                                          ng-class="{0:'bg-light',1:'bg-success'}[item.isOpenRebate]"
                                          ng-bind="{0:'否',1:'是'}[item.isOpenRebate]"></span>
                                </td>
                                <td>{{item.profit}}</td>
                                <td class="t-btns">
                                    <button class="btn btn-sm btn-info" ng-click="addModulesGoods(item)">添加</button>

                                </td>
                            </tr>
                            </tbody>
                        </table>
                        <div ng-if="list.length<=0 && !app.loading" class="padder-v text-center">
                            <span class="h6">~未搜索到任何数据~</span>
                        </div>
                        <div>
                            <circle-loading ng-if="app.loading"></circle-loading>
                        </div>
                    </div>
                    <footer class="panel-footer">
                        <div class="row">
                            <div class="col-sm-5 text-left text-center-xs">
                                <small class="text-muted inline m-t-sm m-b-sm">显示第 {{startRow}} 至 {{endRow}} 项结果，共
                                    {{totalItems}} 项
                                </small>
                            </div>
                            <div class="col-sm-7 text-right text-center-xs">
                                <pagination boundary-links="true" total-items="totalItems" ng-model="currentPage"
                                            ng-change="pageChanged()" max-size="{{maxPageRow}}"
                                            class="pagination-sm m-t-none m-b"
                                            previous-text="上一页" next-text="下一页"
                                            first-text="首页" last-text="尾页"></pagination>
                            </div>
                        </div>
                    </footer>
                </div>
            </div>
        </div>

    </div>
</div>